package server.proxy;

import server.unit.Client;

public class ClientListener extends Thread {
    private Client client;
    private Receiverable receiverable;

    public ClientListener(Client client, Receiverable receiverable) {
        super("Client listener");
        this.client = client;
        this.receiverable = receiverable;
    }

    @Override
    public void run() {
        while(!Thread.interrupted()) {
            String message = client.read();
            receiverable.onReceive(client, message);
        }
    }
}
